================================================================================
  FSI BENCHMARK: FLEXIBLE 3D FLAP IN LAMINAR CROSSFLOW
  solids4Foam | OpenFOAM | Fluid-Structure Interaction
================================================================================

OVERVIEW
--------
This case simulates a flexible 3D flap subjected to a laminar crossflow using
the solids4Foam toolbox. It is set up as a multi-region case with separate
fluid and solid meshes, coupled at the FSI interface.

This benchmark was prepared as part of a FOSSEE IIT Bombay OpenFOAM research
migration project, supervised by Dr. Chandan Bose, University of Birmingham.

--------------------------------------------------------------------------------
PRE-REQUISITES
--------------------------------------------------------------------------------
- OpenFOAM (ESI/Foundation version compatible with solids4Foam)
- solids4Foam toolbox installed and sourced
- solids4FoamScripts.sh accessible in your environment
- (Optional) gnuplot — for automatic generation of deflection and force plots

--------------------------------------------------------------------------------
RUNNING THE CASE
--------------------------------------------------------------------------------

OPTION 1 — Allrun script (recommended)
---------------------------------------
  ./Allrun

  This will automatically:
    1. Convert case format if required (solids4Foam::convertCaseFormat)
    2. Generate the fluid mesh   (blockMesh -region fluid)
    3. Generate the solid mesh   (blockMesh -region solid)
    4. Run the coupled FSI solver (solids4Foam)
    5. Generate deflection.pdf and force.pdf plots via gnuplot (if installed)

  If you see "Permission denied", first run:
    chmod +x Allrun

  For a parallel run:
    ./Allrun parallel

  This will decompose both regions, run solids4Foam in parallel using MPI,
  then reconstruct both regions after completion.

  NOTE: Before running in parallel, update system/decomposeParDict for both
  fluid and solid regions with your preferred decomposition method (scotch,
  simple, etc.) and set the number of processors to match your system.

OPTION 2 — Manual step-by-step
--------------------------------
  Step 1: Generate meshes
    blockMesh -region solid
    blockMesh -region fluid

  Step 2: Run the solver (serial)
    solids4Foam

  Step 3: Run the solver (parallel)
    decomposePar -region fluid
    decomposePar -region solid
    mpirun -np <N> solids4Foam -parallel | tee log.solids4Foam
    reconstructPar -region fluid
    reconstructPar -region solid

  Replace <N> with the number of processors available on your system.

--------------------------------------------------------------------------------
CLEANING THE CASE
--------------------------------------------------------------------------------

  ./Allclean

  This removes all generated mesh files, time directories, logs, plots,
  and postProcessing output, and resets the case to its original state.

  If you see "Permission denied", first run:
    chmod +x Allclean

  The Allclean script also converts the case format back to foam-extend
  compatible format if required.

--------------------------------------------------------------------------------
POST-PROCESSING
--------------------------------------------------------------------------------
- Open the case in ParaView by creating a blank .foam file in the case root:
    touch case.foam
  Then open case.foam in ParaView and apply the OpenFOAMReader.

- If gnuplot is installed, deflection.pdf and force.pdf are generated
  automatically at the end of the Allrun script.
  To generate them manually:
    gnuplot deflection.gnuplot
    gnuplot force.gnuplot       # only if forces.dat is present

--------------------------------------------------------------------------------
CASE STRUCTURE
--------------------------------------------------------------------------------
  constant/
    fluid/          <- Fluid region physical properties and mesh
    solid/          <- Solid region physical properties and mesh
  system/
    fluid/          <- Fluid solver settings (fvSchemes, fvSolution, etc.)
    solid/          <- Solid solver settings
  0/
    fluid/          <- Initial and boundary conditions (fluid)
    solid/          <- Initial and boundary conditions (solid)
  Allrun            <- Automated run script
  Allclean          <- Automated clean script

--------------------------------------------------------------------------------
NOTES
--------------------------------------------------------------------------------
1. This case uses a multi-region mesh. Both blockMesh calls must complete
   successfully before launching solids4Foam.

2. Parallel decomposition must be configured independently for the fluid and
   solid regions in their respective decomposeParDict files under system/.

3. The solver log is written to log.solids4Foam by default via the
   solids4Foam::runApplication function.

4. If running on foam-extend, the Allclean script will automatically convert
   the case format for foam-extend compatibility.

================================================================================
  For questions or errors, contact: tajpuriyamanish777@gmail.com
================================================================================  